<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>QSculpt: qsculpt/include/GlView.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">QSculpt
   &#160;<span id="projectnumber">0.0.1a</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">qsculpt/include/GlView.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> *   Copyright (C) 2006 by Juan Roberto Cabral Flores   *</span>
<a name="l00003"></a>00003 <span class="comment"> *   roberto.cabral@gmail.com   *</span>
<a name="l00004"></a>00004 <span class="comment"> *                                                                         *</span>
<a name="l00005"></a>00005 <span class="comment"> *   This program is free software; you can redistribute it and/or modify  *</span>
<a name="l00006"></a>00006 <span class="comment"> *   it under the terms of the GNU General Public License as published by  *</span>
<a name="l00007"></a>00007 <span class="comment"> *   the Free Software Foundation; either version 2 of the License, or     *</span>
<a name="l00008"></a>00008 <span class="comment"> *   (at your option) any later version.                                   *</span>
<a name="l00009"></a>00009 <span class="comment"> *                                                                         *</span>
<a name="l00010"></a>00010 <span class="comment"> *   This program is distributed in the hope that it will be useful,       *</span>
<a name="l00011"></a>00011 <span class="comment"> *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *</span>
<a name="l00012"></a>00012 <span class="comment"> *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *</span>
<a name="l00013"></a>00013 <span class="comment"> *   GNU General Public License for more details.                          *</span>
<a name="l00014"></a>00014 <span class="comment"> *                                                                         *</span>
<a name="l00015"></a>00015 <span class="comment"> *   You should have received a copy of the GNU General Public License     *</span>
<a name="l00016"></a>00016 <span class="comment"> *   along with this program; if not, write to the                         *</span>
<a name="l00017"></a>00017 <span class="comment"> *   Free Software Foundation, Inc.,                                       *</span>
<a name="l00018"></a>00018 <span class="comment"> *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *</span>
<a name="l00019"></a>00019 <span class="comment"> ***************************************************************************/</span>
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef GLDISPLAY_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define GLDISPLAY_H</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;QGLWidget&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;QPoint&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;QVector&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;QPen&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;QBrush&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;SpEnums.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;Point3D.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;BufferObject.h&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;ISurface.h&quot;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">class </span><a class="code" href="class_document_view.html">DocumentView</a>;
<a name="l00034"></a>00034 <span class="keyword">class </span>QMouseEvent;
<a name="l00035"></a>00035 <span class="keyword">class </span>QWheelEvent;
<a name="l00036"></a>00036 <span class="keyword">class </span><a class="code" href="class_camera.html">Camera</a>;
<a name="l00037"></a>00037 <span class="keyword">class </span><a class="code" href="class_i_renderer.html">IRenderer</a>;
<a name="l00038"></a>00038 <span class="keyword">class </span><a class="code" href="class_scene_node.html">SceneNode</a>;
<a name="l00039"></a>00039 
<a name="l00043"></a><a class="code" href="struct_hit_record.html">00043</a> <span class="keyword">struct </span><a class="code" href="struct_hit_record.html">HitRecord</a>
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045     <span class="keywordtype">int</span> numNamesInStack;
<a name="l00046"></a>00046     <span class="keywordtype">int</span> minDepth;
<a name="l00047"></a>00047     <span class="keywordtype">int</span> maxDepth;
<a name="l00048"></a>00048     <span class="keywordtype">int</span> stackContents;
<a name="l00049"></a>00049 };
<a name="l00050"></a>00050 
<a name="l00057"></a><a class="code" href="class_gl_canvas.html">00057</a> <span class="keyword">class </span><a class="code" href="class_gl_canvas.html">GlCanvas</a> : <span class="keyword">public</span> QGLWidget
<a name="l00058"></a>00058 {
<a name="l00059"></a>00059     Q_OBJECT
<a name="l00060"></a>00060 <span class="keyword">public</span>:
<a name="l00061"></a>00061     <span class="keyword">typedef</span> QMap&lt;int, Camera*&gt; CameraContainer;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063     <span class="keyword">enum</span> PerspectiveType {
<a name="l00064"></a>00064         Front = 0,
<a name="l00065"></a>00065         Back,
<a name="l00066"></a>00066         Top,
<a name="l00067"></a>00067         Bottom,
<a name="l00068"></a>00068         Left,
<a name="l00069"></a>00069         Right,
<a name="l00070"></a>00070         Perspective
<a name="l00071"></a>00071     };
<a name="l00072"></a>00072 
<a name="l00073"></a>00073     <span class="keyword">enum</span> CursorShapeType {
<a name="l00074"></a>00074         None,
<a name="l00075"></a>00075         Cross,
<a name="l00076"></a>00076         Circle,
<a name="l00077"></a>00077         Image
<a name="l00078"></a>00078     };
<a name="l00079"></a>00079 
<a name="l00086"></a>00086     <a class="code" href="class_gl_canvas.html#ad288bbe46bd46d6a2462d04e059e9a1a">GlCanvas</a>(QGLContext * ctx, <a class="code" href="class_document_view.html">DocumentView</a>* parent = 0);
<a name="l00087"></a>00087 
<a name="l00091"></a>00091     <a class="code" href="class_gl_canvas.html#ace13c982e13f1912c59ffcf605ac80b9">~GlCanvas</a>();
<a name="l00092"></a>00092 
<a name="l00098"></a>00098     <span class="keywordtype">bool</span> <a class="code" href="class_gl_canvas.html#aaf0c5632e3ea27443f4d14f94c06b80e">isGridVisible</a>();
<a name="l00099"></a>00099 
<a name="l00103"></a>00103     <span class="keywordtype">bool</span> areNormalsVisible();
<a name="l00104"></a>00104 
<a name="l00113"></a>00113     ObjectContainer <a class="code" href="class_gl_canvas.html#aeacf302d152193915a01dd7578db8614">getSelectedObjects</a>(GLint x, GLint y);
<a name="l00114"></a>00114 
<a name="l00115"></a>00115     PointIndexList getSelectedVertices(GLint x, GLint y,
<a name="l00116"></a>00116                                        GLint width, GLint height);
<a name="l00120"></a>00120     <a class="code" href="class_camera.html">Camera</a>* getViewCamera();
<a name="l00121"></a>00121 
<a name="l00125"></a>00125     <span class="keywordtype">void</span> mapScreenCoordsToWorldCoords(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">double</span> z,
<a name="l00126"></a>00126                                       <span class="keywordtype">double</span> *wx, <span class="keywordtype">double</span> *wy, <span class="keywordtype">double</span> *wz);
<a name="l00130"></a>00130     <span class="keywordtype">void</span> mapScreenCoordsToWorldCoords(<span class="keyword">const</span> Point3&amp;, Point3&amp;);
<a name="l00131"></a>00131     
<a name="l00135"></a>00135     <span class="keywordtype">void</span> mapWorldCoordsToScreenCoords(<span class="keywordtype">double</span> wx, <span class="keywordtype">double</span> wy, <span class="keywordtype">double</span> wz,
<a name="l00136"></a>00136                                       <span class="keywordtype">double</span> *x, <span class="keywordtype">double</span> *y, <span class="keywordtype">double</span> *z);
<a name="l00140"></a>00140     <span class="keywordtype">void</span> mapWorldCoordsToScreenCoords(<span class="keyword">const</span> Point3&amp;, Point3&amp;);
<a name="l00141"></a>00141     
<a name="l00145"></a>00145     PerspectiveType getPerspectiveView() ;
<a name="l00146"></a>00146 
<a name="l00147"></a>00147     <span class="keywordtype">void</span> set3DCursorShape(CursorShapeType shape);
<a name="l00148"></a>00148 
<a name="l00149"></a>00149     CursorShapeType getCursorShape();
<a name="l00150"></a>00150 
<a name="l00151"></a>00151     <span class="keywordtype">void</span> setCursorPosition(Point3 p);
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     Point3 getCursorPosition() ;
<a name="l00154"></a>00154 
<a name="l00155"></a>00155     <span class="keywordtype">void</span> setCursorOrientation(Point3 n);
<a name="l00156"></a>00156 
<a name="l00157"></a>00157     Point3 getCursorOrientation() ;
<a name="l00158"></a>00158 
<a name="l00163"></a>00163     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#aa70231abe2ffd5825c513bf64402a020">setCursorImage</a>(<span class="keyword">const</span> QImage&amp; image);
<a name="l00164"></a>00164 
<a name="l00168"></a>00168     QImage <a class="code" href="class_gl_canvas.html#aff275a38d8b886b0ebf55c71fada0010">getCursorImage</a>();
<a name="l00169"></a>00169 
<a name="l00173"></a>00173     <span class="keywordtype">void</span> enable(GLenum flag) { glEnable(flag); }
<a name="l00174"></a>00174     
<a name="l00178"></a>00178     <span class="keywordtype">void</span> disable(GLenum flag) { glDisable(flag); }
<a name="l00179"></a>00179     
<a name="l00183"></a>00183     <span class="keywordtype">void</span> setPen(<span class="keyword">const</span> QPen&amp; pen);
<a name="l00184"></a>00184     
<a name="l00188"></a>00188     <span class="keyword">const</span> QPen&amp; pen() <span class="keyword">const</span>;
<a name="l00189"></a>00189     
<a name="l00193"></a>00193     <span class="keywordtype">void</span> setBrush(<span class="keyword">const</span> QBrush&amp; pen);
<a name="l00194"></a>00194     
<a name="l00198"></a>00198     <span class="keyword">const</span> QBrush&amp; brush() <span class="keyword">const</span>;
<a name="l00199"></a>00199     
<a name="l00200"></a>00200     
<a name="l00204"></a>00204     <span class="keywordtype">void</span> drawLine(<span class="keyword">const</span> Point3&amp; p1, <span class="keyword">const</span> Point3&amp; p2);
<a name="l00205"></a>00205     
<a name="l00209"></a>00209     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#ab76a62e34dcb54ca0ab090eee18dbbd5">drawLine2D</a>(<span class="keyword">const</span> Point3&amp; p1, <span class="keyword">const</span> Point3&amp; p2);
<a name="l00210"></a>00210     
<a name="l00215"></a>00215     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#a532f54d1a7e02d9642fcf37f4c781f17">drawRect</a>(<span class="keyword">const</span> Point3&amp; p1, <span class="keyword">const</span> Point3&amp; p2, <span class="keywordtype">int</span> mode = 0);
<a name="l00216"></a>00216     
<a name="l00228"></a>00228     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#adf8ae901917ae6a9a18e5f8ac5fc3b7b">drawEllipse</a>(<span class="keyword">const</span> Point3&amp; center, 
<a name="l00229"></a>00229                      <span class="keywordtype">float</span> axis1,
<a name="l00230"></a>00230                      <span class="keywordtype">float</span> axis2,
<a name="l00231"></a>00231                      <span class="keywordtype">float</span> innerAxis1 = 0.0f,
<a name="l00232"></a>00232                      <span class="keywordtype">float</span> innerAxis2 = 0.0f);
<a name="l00233"></a>00233     
<a name="l00249"></a>00249     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#ae6745112f40ae41b34dab0bb36f60a76">drawArc</a>(<span class="keyword">const</span> Point3&amp; center, 
<a name="l00250"></a>00250                  <span class="keywordtype">float</span> startAngle,
<a name="l00251"></a>00251                  <span class="keywordtype">float</span> endAngle,
<a name="l00252"></a>00252                  <span class="keywordtype">float</span> axis1,
<a name="l00253"></a>00253                  <span class="keywordtype">float</span> axis2,
<a name="l00254"></a>00254                  <span class="keywordtype">float</span> innerAxis1 = 0.0f,
<a name="l00255"></a>00255                  <span class="keywordtype">float</span> innerAxis2 = 0.0f);
<a name="l00256"></a>00256     
<a name="l00260"></a>00260     <a class="code" href="class_i_renderer.html">IRenderer</a>* <a class="code" href="class_gl_canvas.html#a5277f562acd39c9009aee04dfb8da14f">renderer</a>() <span class="keyword">const</span> ;
<a name="l00261"></a>00261     
<a name="l00265"></a>00265     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#aa98bbcfee96acbcbeedb55b280478e11">drawScene</a>(<a class="code" href="class_scene.html">Scene</a>* scene);
<a name="l00266"></a>00266     
<a name="l00267"></a>00267     
<a name="l00271"></a>00271     <span class="keywordtype">void</span> begin(GLenum mode);
<a name="l00272"></a>00272     
<a name="l00276"></a>00276     <span class="keywordtype">void</span> end();
<a name="l00277"></a>00277     
<a name="l00278"></a>00278 <span class="keyword">public</span> slots:
<a name="l00284"></a>00284     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#a1cb1098025dd2e1956d34dbaaa6e383e">setDrawingMode</a>(DrawingMode mode);
<a name="l00285"></a>00285 
<a name="l00291"></a>00291     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#a6c643daf33a7f5eb6089325c1be76120">setPerspectiveView</a>(PerspectiveType type);
<a name="l00297"></a>00297     <span class="keywordtype">void</span> <a class="code" href="class_gl_canvas.html#aa7ce7d955363793ca9479eebbc47925b">setGridVisible</a>(<span class="keywordtype">bool</span> value);
<a name="l00298"></a>00298 
<a name="l00302"></a>00302     <span class="keywordtype">void</span> setNormalsVisible(<span class="keywordtype">bool</span> value);
<a name="l00303"></a>00303 
<a name="l00304"></a>00304 <span class="keyword">protected</span>:
<a name="l00305"></a>00305     <span class="keywordtype">void</span> initializeGL();
<a name="l00306"></a>00306     <span class="keywordtype">void</span> resizeGL(<span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h);
<a name="l00307"></a>00307     <span class="keywordtype">void</span> paintGL();
<a name="l00308"></a>00308     <span class="keywordtype">void</span> mouseMoveEvent ( QMouseEvent * e );
<a name="l00309"></a>00309     <span class="keywordtype">void</span> mousePressEvent ( QMouseEvent * e );
<a name="l00310"></a>00310     <span class="keywordtype">void</span> mouseReleaseEvent ( QMouseEvent * e );
<a name="l00311"></a>00311     <span class="keywordtype">void</span> wheelEvent ( QWheelEvent * e );
<a name="l00312"></a>00312 
<a name="l00313"></a>00313     <span class="keywordtype">bool</span> _mousePressed;
<a name="l00314"></a>00314     QPoint _mousePosition;
<a name="l00315"></a>00315 
<a name="l00316"></a>00316 <span class="keyword">private</span>:
<a name="l00320"></a>00320     <span class="keywordtype">void</span> drawGrid();
<a name="l00321"></a>00321     
<a name="l00325"></a>00325     <span class="keywordtype">void</span> drawBoundingBox(<span class="keyword">const</span> <a class="code" href="class_i_surface.html">ISurface</a>* mesh);
<a name="l00326"></a>00326 
<a name="l00327"></a>00327     <span class="keywordtype">void</span> drawCursor();
<a name="l00328"></a>00328 
<a name="l00329"></a>00329     <span class="keywordtype">void</span> drawOrientationAxis();
<a name="l00330"></a>00330     
<a name="l00331"></a>00331     <span class="keywordtype">void</span> drawRectWinCoord(<span class="keyword">const</span> Point3&amp;, <span class="keyword">const</span> Point3&amp; );
<a name="l00332"></a>00332         
<a name="l00333"></a>00333     <span class="keywordtype">void</span> drawEllipseWinCoord(<span class="keyword">const</span> Point3&amp; center,
<a name="l00334"></a>00334                              <span class="keywordtype">float</span> startAngle,
<a name="l00335"></a>00335                              <span class="keywordtype">float</span> endAngle,
<a name="l00336"></a>00336                              <span class="keywordtype">float</span> axis1,
<a name="l00337"></a>00337                              <span class="keywordtype">float</span> axis2,
<a name="l00338"></a>00338                              <span class="keywordtype">float</span> innerAxis1,
<a name="l00339"></a>00339                              <span class="keywordtype">float</span> innerAxis2);
<a name="l00340"></a>00340     
<a name="l00341"></a>00341     <span class="keywordtype">void</span> drawSceneNode(<a class="code" href="class_scene_node.html">SceneNode</a>* node);
<a name="l00342"></a>00342         
<a name="l00343"></a>00343     <span class="keyword">struct </span><a class="code" href="struct_gl_canvas_1_1_impl.html">Impl</a>;
<a name="l00344"></a>00344     QScopedPointer&lt;Impl&gt; _d;
<a name="l00345"></a>00345     
<a name="l00346"></a>00346 };
<a name="l00347"></a>00347 
<a name="l00348"></a>00348 <span class="preprocessor">#endif</span>
<a name="l00349"></a>00349 <span class="preprocessor"></span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sat Aug 27 2011 15:38:52 for QSculpt by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
